import 'package:fbutton/fbutton.dart';
import 'package:flutter/material.dart';
import 'file:///D:/flutterGame/flutter_zhuyili/lib/page/shuerte/shuerteCustomPage.dart';
import 'package:flutterzhuyili/widgets/customWidgets.dart';

class ShuerteMainPage extends StatelessWidget {
  List<String> _data = [
    '1',
    '2',
    '3',
    '4',
    '5',
    '6',
    '7',
    '8',
    '9',
  ];
  List<String> _tangPoetry = [
    '白',
    '日',
    '依',
    '山',
    '尽',
    '黄',
    '河',
    '入',
    '海',
    '流',
    '欲',
    '穷',
    '千',
    '里',
    '目',
    '更',
    '上',
    '一',
    '层',
    '楼',
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text(
            '舒尔特方格',
          ),
        ),
        body: Center(
            child: Padding(
          padding: const EdgeInsets.all(15.0),
          child: Container(height: 400, child: buildGridView(context)),
        )));
  }

  GridView buildGridView(BuildContext context) {
    return GridView.count(
      crossAxisCount: 2,
      childAspectRatio: 1.5,
      crossAxisSpacing: 10,
      mainAxisSpacing: 10,
      physics: NeverScrollableScrollPhysics(),
      children: <Widget>[
        FButton(
          corner: FCorner(
            leftBottomCorner: 6,
            leftTopCorner: 25,
            rightTopCorner: 6,
            rightBottomCorner: 6,
          ),
          alignment: Alignment.center,
          text: "标准",
          style: TextStyle(color: Colors.white),
          color: Color(0xffFF7043),
          onPressed: () {
            Navigator.of(context).push(new MaterialPageRoute(
              builder: (parentContext) {
                //指定跳转的页面
                return MyGridView(
                  rows: 3,
                  columns: 3,
                  childModeTextStyle: TextStyle(
                      fontSize: _data.length > 36 ? 18 : 28,
                      fontWeight: FontWeight.bold,
                      color: Colors.black12),
                  singleBackgroundColor: Color(0x5526A69A),
                  backgroundColors: [Colors.blueGrey, Colors.blue],
                  singleTextStyle: TextStyle(
                      fontSize: _data.length > 36 ? 18 : 28,
                      fontWeight: FontWeight.bold,
                      color: Colors.white),
                  backgroundTextStyle: TextStyle(
                    color: Colors.black38,
                    fontSize: 88,
                    fontWeight: FontWeight.bold,
                  ),
                  data: _data,
                  isChildMode: false,
                  isRandomMode: false,
                  canErrorTimes: 3,
                );
              },
            ));
          },
          clickEffect: true,
        ),
        FButton(
          corner: FCorner(
            leftBottomCorner: 6,
            leftTopCorner: 6,
            rightTopCorner: 25,
            rightBottomCorner: 6,
          ),
          alignment: Alignment.center,
          text: "简单",
          style: TextStyle(color: Colors.white),
          color: Color(0xffFF7043),
          onPressed: () {
            Navigator.of(context).push(new MaterialPageRoute(
              builder: (parentContext) {
                //指定跳转的页面
                return MyGridView(
                  rows: 3,
                  columns: 3,
                  childModeTextStyle: TextStyle(
                      fontSize: _data.length > 36 ? 18 : 28,
                      fontWeight: FontWeight.bold,
                      color: Colors.black12),
                  singleBackgroundColor: Color(0x5526A69A),
                  backgroundColors: [Colors.blueGrey, Colors.blue],
                  singleTextStyle: TextStyle(
                      fontSize: _data.length > 36 ? 18 : 28,
                      fontWeight: FontWeight.bold,
                      color: Colors.white),
                  backgroundTextStyle: TextStyle(
                    color: Colors.black38,
                    fontSize: 88,
                    fontWeight: FontWeight.bold,
                  ),
                  data: _data,
                  isChildMode: true,
                  isRandomMode: false,
                  canErrorTimes: 3,
                );
              },
            ));
          },
          clickEffect: true,
        ),
        FButton(
          corner: FCorner(
            leftBottomCorner: 6,
            leftTopCorner: 6,
            rightTopCorner: 6,
            rightBottomCorner: 6,
          ),
          alignment: Alignment.center,
          text: "困难",
          style: TextStyle(color: Colors.white),
          color: Color(0xffFF7043),
          onPressed: () {
            Navigator.of(context).push(new MaterialPageRoute(
              builder: (parentContext) {
                //指定跳转的页面
                return MyGridView(
                  rows: 3,
                  columns: 3,
                  childModeTextStyle: TextStyle(
                      fontSize: _data.length > 36 ? 18 : 28,
                      fontWeight: FontWeight.bold,
                      color: Colors.black12),
                  singleBackgroundColor: Color(0x5526A69A),
                  backgroundColors: [Colors.blueGrey, Colors.blue],
                  singleTextStyle: TextStyle(
                      fontSize: _data.length > 36 ? 18 : 28,
                      fontWeight: FontWeight.bold,
                      color: Colors.white),
                  backgroundTextStyle: TextStyle(
                    color: Colors.black38,
                    fontSize: 88,
                    fontWeight: FontWeight.bold,
                  ),
                  data: _data,
                  isChildMode: false,
                  isRandomMode: false,
                  canErrorTimes: 0,
                );
              },
            ));
          },
          clickEffect: true,
        ),
        FButton(
          corner: FCorner(
            leftBottomCorner: 6,
            leftTopCorner: 6,
            rightTopCorner: 6,
            rightBottomCorner: 6,
          ),
          alignment: Alignment.center,
          text: "疯狂",
          style: TextStyle(color: Colors.white),
          color: Color(0xffFF7043),
          onPressed: () {
            Navigator.of(context).push(new MaterialPageRoute(
              builder: (parentContext) {
                //指定跳转的页面
                return MyGridView(
                  rows: 3,
                  columns: 3,
                  childModeTextStyle: TextStyle(
                      fontSize: _data.length > 36 ? 18 : 28,
                      fontWeight: FontWeight.bold,
                      color: Colors.black12),
                  singleBackgroundColor: Color(0x5526A69A),
                  backgroundColors: [Colors.blueGrey, Colors.blue],
                  singleTextStyle: TextStyle(
                      fontSize: _data.length > 36 ? 18 : 28,
                      fontWeight: FontWeight.bold,
                      color: Colors.white),
                  backgroundTextStyle: TextStyle(
                    color: Colors.black38,
                    fontSize: 88,
                    fontWeight: FontWeight.bold,
                  ),
                  data: _data,
                  isChildMode: false,
                  isRandomMode: true,
                  canErrorTimes: 3,
                );
              },
            ));
          },
          clickEffect: true,
        ),
        FButton(
          corner: FCorner(
            leftBottomCorner: 25,
            leftTopCorner: 6,
            rightTopCorner: 6,
            rightBottomCorner: 6,
          ),
          alignment: Alignment.center,
          text: "自定义",
          style: TextStyle(color: Colors.white),
          gradient: LinearGradient(colors: [
            Color(0xff00B0FF),
            Color(0xffFFc900),
          ]),
          shadowColor: Colors.black87,
          onPressed: () {
            Navigator.of(context).push(new MaterialPageRoute(
              builder: (parentContext) {
                //指定跳转的页面
                return ShuerteCustomPage();
              },
            ));
          },
          clickEffect: true,
        ),
        FButton(
          corner: FCorner(
            leftBottomCorner: 6,
            leftTopCorner: 6,
            rightTopCorner: 6,
            rightBottomCorner: 25,
          ),
          alignment: Alignment.center,
          text: "唐诗",
          style: TextStyle(color: Colors.white),
          gradient: LinearGradient(colors: [
            Color(0xff00B0FF),
            Color(0xffFFc900),
          ]),
          shadowColor: Colors.black87,
          onPressed: () {
            Navigator.of(context).push(new MaterialPageRoute(
              builder: (parentContext) {
                //指定跳转的页面
                return MyGridView(
                  rows: 4,
                  columns: 5,
                  childModeTextStyle: TextStyle(
                      fontSize: _data.length > 36 ? 18 : 28,
                      fontWeight: FontWeight.bold,
                      color: Colors.black12),
                  singleBackgroundColor: Color(0x5526A69A),
                  backgroundColors: [Colors.blueGrey, Colors.blue],
                  singleTextStyle: TextStyle(
                      fontSize: _data.length > 36 ? 18 : 28,
                      fontWeight: FontWeight.bold,
                      color: Colors.white),
                  backgroundTextStyle: TextStyle(
                    color: Colors.black38,
                    fontSize: 88,
                    fontWeight: FontWeight.bold,
                  ),
                  data: _tangPoetry,
                  isChildMode: true,
                  isRandomMode: false,
                  canErrorTimes: 3,
                  isPoem: true,
                );
              },
            ));
          },
          clickEffect: true,
        ),
      ],
    );
  }
}

enum BaseType {
  //都不能设置属性啥的 奇怪
  Norm,
  Easy,
  Hard,
  Random,
}
